$show_time = 1;
$dependents_phony = 1;
$do_cd = 1;
$preview_continuous_mode = 1;
$bibtex_use = 1.5;
# *.ins cannot generate pdf
push @default_files, '*.dtx';
push @default_files, '*.tikz';

$pdf_mode = 5;
$pdflatex = 'pdflatex -shell-escape -file-line-error -synctex=1 %O %S';
$xelatex = 'xelatex -shell-escape -8bit -file-line-error -no-pdf -synctex=1 %O %S';
$lualatex = 'lualatex -shell-escape -file-line-error -synctex=1 %O %S';

# http://www.alma.ch/perl/perloses.htm
if ($^O eq 'linux') {
	$pdf_previewer = 'xdg-open %S';
	$compiling_cmd = 'xdotool search --name "%D" set_window --name "%D "';
	$success_cmd   = 'xdotool search --name "%D" set_window --name "%D ✔"';
	$failure_cmd   = 'xdotool search --name "%D" set_window --name "%D ✗"';
	$warning_cmd   = 'xdotool search --name "%D" set_window --name "%D ⚠"';
}
elsif ($^O eq 'MSWin32') {
	$pdf_previewer = 'start %S';
}
elsif ($^O eq 'MacOS') {
	$pdf_previewer = 'open %S';
}

add_cus_dep('nlo', 'nls', 0, 'nlo2nls');
push @generated_exts, 'nlo', 'nls';
sub nlo2nls{
	return system("makeindex -s nomencl.ist -o '$_[0].nls' '$_[0].nlo'");
}

# latexmk -pvc- && latexmk -g
add_cus_dep('pytxcode', 'tex', 0, 'pythontex');
push @generated_exts, 'pytxcode';
sub pythontex{
	return system("pythontex '$_[0]'");
}

# docstrip
$clean_full_ext = 'sty cls';
# tex4ht
$clean_full_ext .= ' css html';
# TeX.gitignore:
## Core latex/pdflatex auxiliary files:
$clean_ext = 'aux lof log lot fls out toc fmt fot cb cb2';
## Intermediate documents:
$clean_ext .= ' dvi xdv';
## Bibliography auxiliary files (bibtex/biblatex/biber):
$clean_ext .= ' bcf blg run.xml';
## Build tool auxiliary files:
$clean_ext .= ' fdb_latexmk synctex synctex(busy) synctex.gz synctex.gz(busy) pdfsync';
## Auxiliary and intermediate files from other packages:
# algorithms
$clean_ext .= ' alg loa';
# amsthm
$clean_ext .= ' thm';
# beamer
$clean_ext .= ' nav pre snm vrb';
# changes
$clean_ext .= ' soc';
# comment
$clean_ext .= ' cut';
# cprotect
$clean_ext .= ' cpt';
# elsarticle (documentclass of Elsevier journals)
$clean_ext .= ' spl';
# endnotes
$clean_ext .= ' ent';
# fixme
$clean_ext .= ' lox';
# feynmf/feynmp
$clean_ext .= ' mf mp tfm';
#(r)(e)ledmac/(r)(e)ledpar
$clean_ext .= ' end';
# glossaries
$clean_ext .= ' acn acr glg glo gls glsdefs';
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
$clean_ext .= ' ist';
# gregoriotex
$clean_ext .= ' gaux gtex';
# htlatex
$clean_ext .= ' 4ct 4tc idv lg trc xref';
# hyperref
$clean_ext .= ' brf';
# knitr
# $clean_ext .= ' tikz';
# listings
$clean_ext .= ' lol';
# luatexja-ruby
$clean_ext .= ' ltjruby';
# makeidx
$clean_ext .= ' idx ilg ind';
# minitoc
$clean_ext .= ' maf mlf mlt';
# morewrites
$clean_ext .= ' mw';
# nomencl
$clean_ext .= ' nlg nlo nls';
# pax
$clean_ext .= ' pax';
# pdfpcnotes
$clean_ext .= ' pdfpc';
# scrwfile
$clean_ext .= ' wrt';
# sympy
$clean_ext .= ' sout sympy';
# pdfcomment
$clean_ext .= ' upa upb';
# pythontex
$clean_ext .= ' pytxcode depytx';
# tcolorbox
$clean_ext .= ' listing';
# thmtools
$clean_ext .= ' loe';
# TikZ & PGF
$clean_ext .= ' dpth md5 auxlock';
# todonotes
$clean_ext .= ' tdo';
# vhistory
$clean_ext .= ' hst ver';
# easy-todo
$clean_ext .= ' lod';
# xcolor
$clean_ext .= ' xcp';
# xmpincl
$clean_ext .= ' xmpi';
# xindy
$clean_ext .= ' xdy';
# xypic precompiled matrices
$clean_ext .= ' xyc';
# endfloat
$clean_ext .= ' ttt fff';
# standalone packages
$clean_ext .= ' sta';
# TeX.patch:
# glossaries
$clean_ext .= ' glstex';
# bashful
$clean_ext .= ' stdout stderr exitCode sh';
# markdown
$clean_ext .= ' markdown.in markdown.out markdown.err markdown.lua';
# cleveref
$clean_ext .= ' sed';
# autofancyhdr
$clean_ext .= ' headfootlength';
# docstrip
$clean_ext .= ' hd';

# ex: filetype=perl
